package com.hanoiwiki.webapp.controller.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hanoiwiki.manager.UserManager;
import com.hanoiwiki.model.User;
import com.hanoiwiki.webapp.controller.UserController;

@Controller
@RequestMapping("/user")
public class UserControllerImpl extends BaseControllerImpl implements UserController{

	@Autowired
	private UserManager userManager;
	
	@Override
	@RequestMapping("/add")
	public String saveUser() {
		User user = new User();
		user.setUserName("SANVN");
		user.setPassword("12345");
		userManager.save(user);
		return "";
	}


	@Override
	@RequestMapping(value="/detail",  method = RequestMethod.GET)
	public @ResponseBody User getDetail() {
		User user = new User();
		user.setUserName("SANVN");
		user.setPassword("12345");		
		return user;
	}
}
